<?php

class FP_Application_Subsystem_Locale implements FP_Application_Subsystem_Interface {

    protected $_config = null;

    public function init($pConfig=null){

	$this->_config = $pConfig;

	date_default_timezone_set($this->_config->timezone);

	$session = FP_Application::getSession();

	if (isset($session->locale)){
	    $locale = $session->locale;
	} else
	    $locale = $this->_config->default;

	Zend_Locale::setDefault($locale);

	$translater = new Zend_Translate('array', array(), null, array('disableNotices' => 1));

	$translations = array();

	$translation_file = BASE_DIR . 'lang/' . $locale . '.php';

	if (file_exists($translation_file)){
	    include($translation_file);
	}

	$translater->addTranslation($translations, $locale);

	Zend_Registry::set('Zend_Translate', $translater);


    }

}

?>